package c_gs

import (
	"cade/src/game/app"
	"cade/src/game/app/modules/chat"
	"cade/src/game/msg"
)

func C_ChatEnterRoom(message msg.Message, ctx interface{}) {
	req := message.(*msg.C_ChatEnterRoom)
	plr := ctx.(*app.Player)

	res := &msg.GS_ChatEnterRoom_R{}

	chat.EnterRoom(plr, req.Id, func(ec int32, records []*msg.ChatTextEntry) {
		res.ErrorCode = ec
		res.RecentRecords = records

		plr.SendMsg(res)
	})
}
